package tcln.gxtx.client.utils;

/**
 * @param <P>
 *            Initial parameter type.
 * @param <R>
 *            Return type.
 * @author Truong Chau Lien Ngoc (lienngoc@gmail.com)
 */
public abstract class Executable<P, R> {

    /**
     * Executes with input parameter and result.
     * 
     * @param params
     * @return
     */
    public abstract R execute(P params);

    /**
     * Executes with input parameter and result. However, this method is dedicated for the case when error should be
     * handled. By default, nothing is handled. Subclasses may override this method for a custom handling.
     * 
     * @param params
     * @param err
     * @return
     */
    public R executeOnError(P params, Throwable err) {
        return null;
    }
}
